<?php

/**
 * @Author:      ZH
 * @DateTime:    2016-2-16 13:49:41
 * @Description: 用于管理PMS 系统的管理账户
 */
class PMSUser extends Eloquent  {


    protected $table = 'pms_user';

    public static $status = array(
        1 => '正常',
        2 => '冻结',
        3 => '删除',
    );
    
    public static function findUserByUP($user_name,$password){
        return PMSUser::where("user_name", $user_name)->where("password", $password)->first();
    }
  
    public static function created_by_user($created_type,$id){
        $table_name = $created_type == 1 ? "SCUser" : "PMSUser" ; //根据用户类型，查询不同的表
        return $table_name::find($id);
    }
    
}
